<template>
	<view class="myrate">
		<view class="ratebox">
			<view class="rate" v-for="item in rateList" :key="item.orderid">
				<view class="master">
					<view class="master_name">
						技工:  {{ item.shiname }}
					</view>
					<view class="isgood" :class="{'good': item.hierarchy == 1, 'zhong': item.hierarchy == 2, 'cha': item.hierarchy == 3}">
						<view class="icon">
							<text class="iconfont icon-haoping" v-if="item.hierarchy == 1"></text>
							<text class="iconfont icon-zhongping" v-if="item.hierarchy == 2"></text>
							<text class="iconfont icon-chaping" v-if="item.hierarchy == 3"></text>
						</view>
						<view class="txt">
							{{ item.hierarchy | filterRate }}
						</view>
					</view>
				</view>
				<view class="content">
					<view class="rate_info">
						#<text class="inner">{{ item.explain }}</text>#
					</view>
					<view class="items order">
						<view class="label">
							订单编号:
						</view>
						<view class="orderid">
							{{ item.orderid }}
						</view>
					</view>
					<view class="items order">
						<view class="label">
							服务项目:
						</view>
						<view class="orderid">
							{{ item.name }}
						</view>
					</view>
					<view class="items order">
						<view class="label">
							订单金额:
						</view>
						<view class="orderid">
							{{ item.orderprice }}元
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				rateList: [],
			}
		},
		computed: {
			token() {
				return this.$store.state.token;
			},
		},
		filters: {
			filterRate( val ) {
				if(val == 1) {
					return "好评"
				} else if(val == 2) {
					return "中评"
				} else {
					return " 差评"
				}
			},
		},
		onShow() {
			this.getRateList()
		},
		methods: {
			// 获取我都评价列表
			async getRateList() {
				let res = await this.$Request("POST", "/appraise/pinglist", { token: this.token })
				// console.log(res);
				let code = res.data.code
				if(code == 200) {
					this.rateList = res.data.data
				} else {
					this.rateList = []
				}
			},
		}
	}
</script>

<style scoped lang="scss">
	.myrate {
		width: 100%;
		padding: 20rpx 30rpx;
		box-sizing: border-box;
		.ratebox {
			width: 100%;
			box-sizing: border-box;
			.rate {
				width: 100%;
				padding: 20rpx;
				box-sizing: border-box;
				box-shadow: 0 0 5rpx #007eff;
				border-radius: 10rpx;
				margin: 20rpx auto;
				.master {
					width: 100%;
					display: flex;
					align-items: center;
					justify-content: space-between;
					border-bottom: 1px solid #f5f5f5;
					padding: 20rpx 0;
					.good {
						color: #007eff;
					}
					.zhong {
						color: green;
					}
					.cha {
						color: red;
					}
					.isgood {
						display: flex;
						align-items: center;
						.icon {
							margin-right: 10rpx;
						}
					}
				}
				.content {
					width: 100%;
					padding: 10rpx 20rpx;
					box-sizing: border-box;
					.rate_info {
						color: #007eff;
						padding: 20rpx 0;
						.inner {
							color: green;
							width: 100%;
							
						}
						
					}
					.items {
						width: 100%;
						display: flex;
						align-items: center;
						font-size: 24rpx;
						justify-content: space-between;
						margin: 10rpx 0;
					}
				}
			}
		}
	}
</style>
